﻿using JESAI.Redis.Abstracts.Commands;
using JESAI.Redis.Datas;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;

namespace JESAI.Redis.Abstracts.Messages
{
    public interface IMessageTransport
    {
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="command"></param>
        Task SendAsync(Stream stream, IRedisCommandArg commandArg);

        /// <summary>
        /// 读取消息
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        Task<object> ReceiveMessageAsync(Stream stream);

        /// <summary>
        /// 读取简易消息
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        /// <exception cref="NotSupportedException"></exception>
        /// <exception cref="RedisExecException"></exception>
        Task<RedisData> ReceiveSimpleMessageAsync(Stream stream);
    }
}
